stage.set_background("schoolentrance")
stage.wait(2)
stage.create_grid_overlay(50, "blue")
stage.set_background_color("azure")
emma = codesters.Sprite("person1")
emma.set_size(0.5)
michael = codesters.Sprite("person2")
michael.set_size(0.5)
emma_x = random.randint(-230,230)
emma_y = random.randint(-230,230)
t = codesters.Teacher()
try:
tval3x = emma.get_x()
tval3y = emma.get_y()
except:
tval3x = "DNE"
tval3y = "DNE"
t3 = TestObjective()
t3.add_success(tval3x == emma_x and tval3y == emma_y, "Great job!")
t3.add_failure(tval3x == "DNE", "Did you delete the sprite named emma?")
t3.add_failure(tval3x == -100 and tval3y == -50, "Did you change the coordinates in Go To?")
t3.add_failure(tval3x == 0 and tval3y == 0, "Did you drag a Go To tool to the bottom of your code?")
t3.add_failure(tval3x == emma_x and tval3y != emma_y, "Did you change the y-coordinate?")
t3.add_failure(tval3x != emma_x and tval3y == emma_y, "Did you change the x-coordinate?")
tester = TestManager()
tester.add_test_list([t3])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)